
// home头部商品分类模块
import { findHeadCategory } from '@/api/home'
import { category } from '@/utils/constant'
export default {
  namespaced: true,
  state: {
    list: category.map((item, index) => ({ id: index, name: item }))
  },
  mutations: {
    setList (state, value) {
      state.list = value
    }
  },
  actions: {
    async getList (store) {
      const res = await findHeadCategory()
      store.commit('setList', res.result)
    }
  }
}
